package com.xunfei.yuyin.ui;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.blankj.utilcode.util.ToastUtils;
import com.xunfei.yuyin.databinding.ModuleXunfeiYuyinXukunActivityVoiceBinding;
import com.xunfei.yuyin.tool.XunfeiVoiceTool;

public class VoiceActivity extends AppCompatActivity {
    private ModuleXunfeiYuyinXukunActivityVoiceBinding binding;
    private String content;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ModuleXunfeiYuyinXukunActivityVoiceBinding.inflate(getLayoutInflater());
        XunfeiVoiceTool.getInstance().init(this,"776ae0cc","xiaoyan");
        setContentView(binding.getRoot());
        binding.btnHecheng.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                content = binding.etContent.getText().toString();
                if (content == null||content.isEmpty()){
                    ToastUtils.showShort("请输入内容!");
                    return;
                }
                XunfeiVoiceTool.getInstance().speek(content);

            }
        });

    }
}
